package com.cn.xly2023.controller;

import com.cn.xly2023.pojo.Cs;
import com.cn.xly2023.pojo.Goods;
import com.cn.xly2023.service.CsService;
import com.cn.xly2023.service.GoodsService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@Api(value = "客服数据test",tags = "客服数据接口API")
@RequestMapping("/cs")
public class CsController {
    @Resource
    private CsService csService;


    @RequestMapping(value = "/selectAll",method = RequestMethod.GET)
    public Map<String,Object> selectAll(){
        return csService.selectAll();
    }

    @RequestMapping(value = "/selectById",method = RequestMethod.GET)
    public Map<String,Object> selectById(@RequestParam Integer id){
        return csService.selectById(id);
    }

    @RequestMapping(value = "selectByPage",method = RequestMethod.GET)
    public Map<String,Object> selectByPage(@RequestParam Integer page,@RequestParam Integer limit,String csname,String gender){
        return csService.selectByPage(page,limit,csname,gender);

    }

    @RequestMapping(value = "/insert",method = RequestMethod.POST)
    public Map<String,Object> insert(@RequestBody Cs cs){
        return csService.insert(cs);

    }

    @RequestMapping(value = "updateById",method = RequestMethod.POST)
    public Map<String,Object> update(@RequestBody Cs cs) {
        return csService.updateById(cs);
    }


    @RequestMapping(value = "deleteById",method = RequestMethod.POST)
    public Map<String,Object> delete(@RequestParam Integer id){
        return csService.deleteById(id);}

}
